

<template>

  <div class="addUserInfo">
     <ViewTitle text="备案" />
   
   
     <div class="box1">
            <div>
            <span>医保挂号医生:</span>
            <selectInput :thatF="this"></selectInput>
          
          </div>
           <div class="yisheng">
        <span>慢特病病种:</span>

        <el-popover
          placement="bottom-end"
          v-model="mantebing.show"
          trigger="focus"
        >
          <el-input
            placeholder="请输入名称"
            slot="reference"
            v-model="mantebing.name"
            size="mini"
            @input="dictMantebing()"
          >
         
          </el-input>


          <el-table
            v-loading="mantebing.loading"
            @current-change="xuanzeMantebing"
            highlight-current-row
            height="300"
         
            :data="
              mantebing.data.filter(
                (data) =>
                  !mantebing.name ||
                  data.name
                    .toLowerCase()
                    .includes(mantebing.name.toLowerCase())
              )
            "
          > <el-table-column type="index" label="序号" width="50">
            </el-table-column>

            <el-table-column
              width="100"
              property="m_code"
              label="慢特病编码"
            ></el-table-column>
            <el-table-column
              width="100"
              property="number"
              label="内部编码"
            ></el-table-column>

            <el-table-column
              width="100"
              property="name"
              label="疾病名称"
            ></el-table-column>
          </el-table>

           <el-pagination
            :current-page="mantebing.page"
            :page-size="mantebing.limit"
            @current-change="mantebingPage"
            :total="mantebing.count"
            layout="prev, pager, next"
          >
          </el-pagination>
        </el-popover>
      </div>
          <div>
        <span>病种类型:</span>
       
         <!-- <el-form-item label="病种类型:"> -->
                      <el-select
                      v-model="params.dise_type_code"
                      placeholder="病种类型"
                       size="mini"
                    >
                      <el-option
                        v-for="(item, index) in binzhonglei"
                        :key="index"
                        :label="item.name"
                        :value="item.value"
                     
                        >{{ item.name }}</el-option
                      >
                    </el-select>
                  <!-- </el-form-item> -->
       
     
        </div>
          <div>
        <span>医院鉴定日期:</span>
       
        <el-date-picker
          
          v-model="params.hosp_ide_date"
          size="mini"
          type="date"
          
       
          value-format="yyyy-MM-dd"
          placeholder="选择日期"
        >
        </el-date-picker> 

        
      </div>
        <div>
            <span>开始日期 :</span>
           <div>
               <el-date-picker
              v-model="params.begndate"
              type="date"
               size="mini"
             
                value-format="yyyy-MM-dd"
                  placeholder="开始日期"
             >
            </el-date-picker>
            </div>
        </div>
           <div>
            <span>结束日期 :</span>
           <div>
               <el-date-picker
              v-model="params.enddate"
              type="date"
               size="mini"
             
                value-format="yyyy-MM-dd"
                  placeholder="结束日期"
             >
            </el-date-picker>
            </div>
        </div>
    
    </div> 
        
   
   
    
    <div class="buts">
        
        <el-button  class="butB_Add"  @click="save(2)">备案</el-button>
     
    </div>
  </div>
</template>
<script>
let t;
import selectInput from "@/components/select"
import ViewTitle from "@/forComponents/viewTitle/index.vue";
import { mapState, mapActions } from "vuex";
import {

  getdictIndex,
 
} from "@/api/register";
export default {
  props: ["thatF"],
  data() {
    return {
        setSelectInput:{
          placeholder:'请选择医生',
          key:'user',
          url:'getUserIndex',
         keyword:'',
         id:'',

        list:[
        
          {label:'医生',prop:'real_name'},
          {label:'科室',prop:'dept_name'},
          {label:'职称',prop:'positional_title'},
        ],

      },
      params: {
      
        hosp_ide_date: "",
        begndate: "",
        enddate: "",
        time:'',
        dise_type_code:''
      },
      binzhonglei:[],
      doctor: {
        doctor_show: false,

        doctor_name: "", //患者姓名
        doctor_id: "", //患者id

        page: 1,
        limit: 20,
        doctorLoading: false,

        data: [],
        count: 0,
      },
      mantebing: {
        show: false,

        name: "", //患者姓名
        id: "", //患者id

        page: 1,
        limit: 20,
        loading: false,

        data: [],
        count: 0,
      },
    };
  },
  mounted() {
    t = this;
 

  //  this.getdoctorList();
    this.dictMantebing();
    this.getdiet_list()
  },

  methods: {
        
    save() {

   if(!t.setSelectInput.id){
            return t.$message.error("请选择备案医生")
      }
      if(!t.mantebing.name){
            return t.$message.error("请选择慢特病类型")
      }
       if(!t.params.hosp_ide_date){
            return t.$message.error("请选择鉴定日期")
      }
      //    if(!t.params.begndate){
      //       return t.$message.error("请选择开始日期和结束日期")
      // }
      let d = {
        doctor_id:t.setSelectInput.id,
        psn_no: t.thatF.baseinfo.psn_no,
        insutype: t.thatF.params.insutype,
        member_id: t.thatF.setSelectInput.id,
        insu_options: t.thatF.params.selectData.insuplc_admdvs,
        insuplc_admdvs:t.thatF.params.selectData.insuplc_admdvs,
        hosp_ide_date: t.params.hosp_ide_date,
        begndate: t.params.begndate,
        enddate: t.params.enddate,
        opsp_dise_code:t.mantebing.id,
        opsp_dise_name:t.mantebing.name,
        dise_type_code:t.params.dise_type_code,
        mdtrt_cert_type:t.thatF.params.cert_type,
        mdtrt_cert_no:t.thatF.params.cert_no
      };

            t['_API'].getclinic_ybUploadPsnSlowDisease(d).then(res=>{
                if(res.code==200){
                     this.$message({
                                message: res.message,
                                type: 'success'
                            });
                            t.thatF.thatF.params.page=1;
                            t.thatF.thatF.getList()
                }
            })
    },

    dictMantebing() {
      this.mantebing.loading = true;
      let d = {
        keyword: this.mantebing.name,
        page: this.mantebing.page,
        limit: this.mantebing.limit,
      };
      t["_API"].getdict_dataGetChronicDiseaseDict(d).then((res) => {
        this.mantebing.loading = false;
        if (res.code == 200) {
          this.mantebing.data = res.data.list;

          this.mantebing.count = res.data.count;
        }
      });
    },

    mantebingPage(e) {
      this.mantebing.page = e;
      this.dictMantebing();
    },

    xuanzeMantebing(item) {
      this.mantebing.name = item.name;
      this.mantebing.id = item.m_code;

      this.mantebing.show = false;
    },

         getdiet_list() {
      getdictIndex({ group_id: "73" })
        .then(res => {
          let data = res.data;

          data.forEach((item, key) => {
           
           if (item.id==73) {
              this.binzhonglei=item.items
            }
            

           
          });
        })
        .catch(e => {});

    },

   
  },

  computed: {
    ...mapState({
      yibao_insutype: (state) => state.dictBai.yibao_insutype,
      yibao_med_type: (state) => state.dictBai.yibao_med_type,
    }),
  },
  components: {
    ViewTitle,
    selectInput,
    //  FormInfo
  },
};
</script>
<style lang='scss' scoped>
.addUserInfo {
  padding: 0 4%;
  .box1 {
    display: flex;
    flex-wrap: wrap;
    padding: 20px 0;
    > div {
      position: relative;
      width: 33%;
      display: flex;
      align-items: center;
      // justify-content: center;
      margin-bottom: 20px;

      > span {
        display: inline-block;
          width: 100px;
      }
      /deep/ .el-input {
        width: 150px;
      }
    }
  }
  .box3 {
    margin: 20px 0;
  }

  .dukaBut {
    margin: 0px 0 20px;
  }
}

.buts {
  display: flex;
  align-items: center;
  justify-content: center;
  .butB_Add1 {
    width: 200px;
    position: absolute;
    bottom: 28px;
    right: 45px;
  }
  .butB_Add2 {
    width: 200px;
    position: absolute;
    bottom: 28px;
    right: 280px;
  }
}
</style>